// Read context
int firstLine = counter.getAndAdd(linesPerThread);
int lastLine = firstLine + linesPerThread - 1;

rs.absolute(firstLine - 1);
for (int i = firstLine; i <= lastLine; ++i) {
  rs.next();
  val1 = rs.getInt(1);
  val2 = rs.getString(2);
  val3 = rs.getString(3);
  val4 = rs.getDate(4);
  val5 = rs.getDouble(5);
  val6 = rs.getInt(6);
  val7 = rs.getDate(7);
  val8 = rs.getString(8);
}

// Update context
initUpdateValues();
int firstLine = counter.getAndAdd(linesPerThread);
int lastLine = firstLine + linesPerThread - 1;

rs.absolute(firstLine - 1);
for (int i = firstLine; i <= lastLine; ++i) {
  rs.next();
  rs.updateInt(1, val1);
  rs.updateString(2, val2);
  rs.updateString(3, val3);
  rs.updateDate(4, val4);
  rs.updateDouble(5, val5);
  rs.updateInt(6, val6);
  rs.updateDate(7, val7);
  rs.updateString(8, val8);
  rs.updateRow();
}

// Insert context
initUpdateValues();
for (int i = 0; i < linesPerThread; ++i) {
  rs.moveToInsertRow();
  rs.updateInt(1, val1);
  rs.updateString(2, val2);
  rs.updateString(3, val3);
  rs.updateDate(4, val4);
  rs.updateDouble(5, val5);
  rs.updateInt(6, val6);
  rs.updateDate(7, val7);
  rs.updateString(8, val8);
  rs.insertRow();
  rs.moveToCurrentRow();
}

// Delete context
int firstLine = counter.getAndAdd(linesPerThread);
int lastLine = firstLine + linesPerThread - 1;

rs.absolute(firstLine - 1);
for (int i = firstLine; i <= lastLine; ++i) {
  rs.next();
  rs.deleteRow();
}
